package A1_2;

import java.util.List;

// 主方法，用于测试
public class Main {
    public static void main(String[] args) {
        // 创建建筑
        Building building1 = new Building("Building A");
        Building building2 = new Building("Building B");

        // 创建课程并添加到建筑中
        Course course1 = new Course("Math", building1);
        Course course2 = new Course("Science", building1);
        Course course3 = new Course("History", building2);

        building1.addCourse(course1);
        building1.addCourse(course2);
        building2.addCourse(course3);

        // 创建学院并添加建筑
        College college = new College("My College");
        college.addBuilding(building1);
        college.addBuilding(building2);

        // 测试查找课程
        Course foundCourse = college.findCourseByName("Math");
        if (foundCourse != null) {
            System.out.println("Found course: " + foundCourse.getName() + " in building: " + foundCourse.getBuilding().getName());
        } else {
            System.out.println("Course not found");
        }

        // 测试查找建筑中的课程
        List<Course> coursesInBuildingA = college.findCoursesInBuilding("Building A");
        for (Course course : coursesInBuildingA) {
            System.out.println("Course in Building A: " + course.getName());
        }
    }
}